package com.cdu.guoxinan.www.smartcom.service.impl;

import com.cdu.guoxinan.www.smartcom.domian.dto.AddRequestDTO;
import com.cdu.guoxinan.www.smartcom.domian.dto.RepairApplyDTO;
import com.cdu.guoxinan.www.smartcom.domian.dto.RequestDTO;
import com.cdu.guoxinan.www.smartcom.domian.vo.RepairApplyVO;
import com.cdu.guoxinan.www.smartcom.domian.vo.SelectOption;
import com.cdu.guoxinan.www.smartcom.mapper.RepairApplyMapper;
import com.cdu.guoxinan.www.smartcom.service.RepairApplyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RepairApplyServiceImpl implements RepairApplyService {

    @Resource
    private RepairApplyMapper repairApplyMapper;

    @Override
    public PageInfo<RepairApplyVO> getAllRepairs(RepairApplyDTO dto) {
        PageHelper.startPage(dto.getPage(), dto.getLimit());
        List<RepairApplyVO> list = repairApplyMapper.getAllRepairs(dto);
        return new PageInfo<>(list);
    }

    @Override
    public List<SelectOption> getPriorityOptions() {
        return repairApplyMapper.getPriorityOptions();
    }

    @Override
    public List<SelectOption> getStatusOptions() {
        return repairApplyMapper.getStatusOptions();
    }

    @Override
    public int addRepairApply(AddRequestDTO addRequestDTO) {
        return repairApplyMapper.addRepairApply(addRequestDTO);
    }

    @Override
    public int updateRepairApply(RequestDTO requestDTO) {
        return repairApplyMapper.updateRepairApply(requestDTO);
    }

    @Override
    public int deleteRepairApply(Long requestId) {
        return repairApplyMapper.deleteRepairApply(requestId);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
            return repairApplyMapper.deleteBatch(ids);
    }


}

